package ModelImplementation

import "time"

type MonthlySchedule struct {
}

func (ms MonthlySchedule) IsLastDayOfMonth(date time.Time) bool {
	m1 := date.Month()
	m2 := date.AddDate(0, 0, 1).Month()

	return m1 != m2
}

func (ms MonthlySchedule) IsPayData(date time.Time) bool {
	return ms.IsLastDayOfMonth(date)
}

func (ms MonthlySchedule) GetSalaryStartDate(SalaryEndDate time.Time) time.Time {
	lastDayOfMonth := SalaryEndDate.Day()
	firstDayOfMonth := SalaryEndDate.AddDate(0, 0, -(lastDayOfMonth - 1))
	return firstDayOfMonth
}
